package com.suneast.suneaststore.modules.homepage.servicemall;

import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suneast.suneaststore.R;

import java.util.List;

public class CalendarAdapter extends BaseQuickAdapter<CalendarBean, CalendarAdapter.VH> {

    public CalendarAdapter(int layoutResId, @Nullable List<CalendarBean> data) {
        super(layoutResId, data);
    }

    public CalendarAdapter(@Nullable List<CalendarBean> data) {
        super(data);
    }

    public CalendarAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(VH helper, CalendarBean item) {
        helper.setText(R.id.tv_year_month, String.format(helper.itemView.getResources().getString(R.string.year_month),
                String.valueOf(item.getYear()), String.valueOf(item.getMonth())));
        RecyclerView rv = helper.getView(R.id.rv_calendar_item);
        rv.setLayoutManager(new GridLayoutManager(helper.itemView.getContext(), 7));
        CalendarItemAdapter itemAdapter = new CalendarItemAdapter(R.layout.item_calendar_item,item.getDatas());
        rv.setAdapter(itemAdapter);
    }

    public static class VH extends BaseViewHolder {
        public VH(View view) {
            super(view);
        }
    }

}
